﻿using System.Net;

namespace PacketRush.Core
{
    /// <summary>
    /// Server-side networking providers implement the IServerNetworkingProvider interface
    /// in order to connect, send and receive messages to connected clients over a networking protocol.
    /// </summary>
    /// <remarks>
    /// <see cref="PacketRush.Core.NetServer"/> uses an implementation of IServerNetworkingProvider
    /// for sending, receiving and managing client connections, this allows a pluggable underlying communication layer without
    /// effecting the core logic that NetServer provides to the application.
    /// </remarks>
    public interface IServerNetworkingProvider : INetworkingProvider
    {
        /// <summary>
        /// Start the networking provider.
        /// </summary>
        /// <param name="localEndPoint">The local end point.</param>
        void Start(EndPoint localEndPoint);

        /// <summary>
        /// Accept pending connections, NetServer will poll this method to get
        /// new connections.
        /// </summary>
        /// <returns>An array of INetConnection.</returns>
        INetConnection[] AcceptConnections();

        /// <summary>
        /// Disconnect the given connection.
        /// </summary>
        /// <param name="connection">The connection to disconnect.</param>
        void Disconnect(INetConnection connection);

        /// <summary>
        /// The current server settings.
        /// </summary>
        NetServerSettings ServerSettings { get; set; }

    }
}
